#include <allegro.h>
#include <stdio.h>

FONT* load_damage_font(const char* filename)
{
    FONT* f = load_font(filename, NULL, NULL);
    if (f == NULL) return f;
    // Specification:
    //  First char: SPACE
    //  Last char: 9
    return f;
    return extract_font_range(f, 32, '9');
}

int main(int argc, char** argv)
{
    FONT* f;
    if (argc != 2) {
        fprintf(stderr, "Usage: %s <font>\n", argv[0]);
        return 1;
    }
    allegro_init();
    install_keyboard();
    set_color_depth(32);
    set_gfx_mode(GFX_AUTODETECT_WINDOWED, 640, 480, 0, 0);
    clear_to_color(screen, makecol32(200, 200, 200));
    f = load_damage_font(argv[1]);
    if (f == NULL) {
        fprintf(stderr, "%s: Couldn't load font %s\n", argv[0], argv[1]);
        goto end;
    }

    while (!key[KEY_ESC]) {
        textout_centre_ex(screen, f, "2", 320, 70, -1, -1);
        textout_centre_ex(screen, f, "0", 320, 80, -1, -1);
        textout_centre_ex(screen, f, "+", 320, 90, -1, -1);
        textout_centre_ex(screen, f, "+ - 0123456789 ! 9876543210 - +", 320, 100, -1, -1);
        textout_centre_ex(screen, f, "+5", 320, 120, -1, -1);
        textout_centre_ex(screen, f, "-100!", 320, 130, -1, -1);
        rest(10);
    }

end:
    allegro_exit();
    return 0;
}
